using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableParticleDao:DaoBase<TableParticle>
    {
        public override void AddPrimaryIndex(TableParticle model)
        {
            cachePrimary[model.ParticleId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableParticle.txt";
        }

        protected override TableParticle ParseRowData(string[] rowData)
        {
            TableParticle data = new TableParticle();
			data.ParticleId = rowData [0];
			data.ResourcePath = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.Duration = 0;
            }
            else
            {
                data.Duration = double.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.IsLoop = 0;
            }
            else
            {
                data.IsLoop = int.Parse(rowData[3]);
            }

            return data;
        }



    }

}
